<template>
    <div class="tmpl">
        <nav-bar title="新闻列表"></nav-bar>
        <ul class="mui-table-view">
            <li class="mui-table-view-cell mui-media" v-for="(getnewsl,index) in getnewslist" :key="index">
                <router-link :to="{name:'news_getnew',query:{id:getnewsl.id}}">
                    <img class="mui-media-object mui-pull-left" :src="getnewsl.img_url">
                    <div class="mui-media-body">
                        {{getnewsl.title}}
                        <p class='mui-ellipsis'><span>{{getnewsl.add_time|DataFormat}}</span><span>{{getnewsl.click}}点击</span></p>
                    </div>
                </router-link>
            </li>
        </ul>
    </div>
</template>

<script>
    export default {
        name: "news",
        data(){
            return {
                getnewslist:[]
            }
        },
        created(){
            this.Ajax.get("getnewslist").then(res=>{
                console.log(res);
                this.getnewslist=res.data.message;
            }).catch(err=>{
                console.log(err);
            })
        }
    }
</script>

<style scoped lang="less">
    .mui-table-view {
        .mui-ellipsis {
            display: flex;
            justify-content: space-between;
        }
    }

</style>